package com.cai.activiti_demo1.delegate.demo;

import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

@Slf4j
public class LoginFailDelegate implements JavaDelegate {
    private static Integer loginCount=0;
    @Override
    public void execute(DelegateExecution execution) {
        addLoginCount();
        if (loginCount>=3){
            log.info("登录失败,你的账号已被冻结。联系管理员解封");
            return;
        }
        log.info("登录失败,你还有"+(3-loginCount)+"次机会。");
    }

    public void addLoginCount(){
        loginCount=loginCount+1;
    }
}
